package cz.idsv.web.mvc.model.service;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;

import cz.idsv.web.mvc.model.dao.ProductTypeDao;
import cz.idsv.web.mvc.model.entity.ProductTypeEntity;


@Service("ProductTypeService")
public class ProductTypeServiceImpl implements ProductTypeService {

	@Autowired()
	private ProductTypeDao productTypeDao;
	
	
	public Collection<ProductTypeEntity> findProductType() throws DataAccessException{
		return productTypeDao.findProductType();
	}

	public void save( ProductTypeEntity  productTypeEntity) {
		 productTypeDao.save( productTypeEntity);
	}

	@Secured ({"ROLE_ADMIN"})
	public void delete( ProductTypeEntity  productTypeEntity) {
		 productTypeDao.delete( productTypeEntity);
	}

	public  ProductTypeEntity findProductTypeById(Integer id)
			throws DataAccessException {
		return  productTypeDao.findProductTypeById(id);
	}
}
